1. Field of the Invention
The present invention relates to a method and an apparatus for carrying out an interpolation operation on original image data comprising pixels each including a channel representing transparency and channels representing color or density, and also to a computer-readable recording medium storing a program to cause a computer to execute the interpolation operation method.
2. Description of the Related Art
Enlargement reproduction or reduction reproduction of image data obtained by photoelectrically reading an image recorded on a film or by photographing a subject with a digital camera has been carried out. Such enlargement or reduction of image data has been carried out by obtaining interpolated image data having pixel spacing different from that of original image data through an interpolation operation on the original image data. As the interpolation operation, high-degree interpolation operations, such as the cubic spline interpolation operation generating a sharp interpolated image and the B spline interpolation operation generating a comparatively smooth interpolated image, or linear interpolation operations are used.
Meanwhile, image data are RGB or RGBxcex1 data defined as a 3-channel or 4-channel image respectively. Especially, the xcex1 channel in the RGBxcex1 image data defines transparency at a pixel in the original image represented by the image data. Depending on the value of the xcex1 channel, a composition ratio of the image data and a mount image which the image data are printed on or inserted in is changed. More specifically, the smaller the a value is, the more the mount becomes visible through the image. By changing the xcex1 channel value near the border between the original image and the mount to a small value, the image is composed with the mount as if the image is blended into the mount. For example, as shown in FIG. 6, when pixels each having values of R=G=B=255 (xcex1=0), R=G=B=33 (xcex1=1), and R=G=B=33 (xcex1=1) are pasted on a black mount (R=G=B=0), the pixel values are changed according to the xcex1 channel value, based on the following Equation (1) below:
P=F2xc3x97(1xe2x88x92xcex1)+F1xc3x97xcex1xe2x80x83xe2x80x83(1)
where P is a value of a pixel pasted on the mount,
F1 is a value of a pixel of the image to be pasted on the mount, and
F2 is a value of a pixel of the mount at the position corresponding to the pixel value of the image.
As shown in FIG. 7, the image is then pasted on the mount in such a manner that only the pixels whose xcex1 value is 1 remain.
As has been described above, when the transparency is defined by the xcex1 channel, an image can be blended into a mount and the image and the mount can be composed together in a more natural manner.
It is also possible to enlarge or reduce an original image by carrying out an interpolation operation on image data having the xcex1 channel. For simplicity, let""s take an example of enlarging image data by 2 through linear interpolation. The RGB values and the xcex1 channel value of the pixels shown in FIG. 6 are RGB=255 (xcex1=0) (hereinafter, for simplicity, an expression xe2x80x9cRGB=nxe2x80x9d is used for the case of R=G=B=n where n is a number), RGB=144 (xcex1=0.5), RGB=33 (xcex1=1), RGB=33 (xcex1=1), and RGB=33 (xcex1=1), as shown in FIG. 8. In FIG. 8, the pixels augmented as a result of interpolation are shown as black dots. When the image data interpolated as has been described above are pasted on the black mount, the values of each pixel are changed according to the xcex1 channel value, based on Equation (1), and an image having the pixel values shown in FIG. 9 is pasted onto the mount.
However, when the image data having the xcex1 channel are interpolated, a portion where pixel values are larger than those of surrounding pixels, such as RGB=72, is generated at a border where the xcex1 channel value changes from 1 to 0, as shown in FIG. 9. As a result, a white streak is generated at the border between the pasted image and the mount. In order to prevent such white streaks from occurring, a linear interpolation method (hereinafter called the pre-multiplied xcex1 method) can be used.
In the pre-multiplied xcex1 method, the RGB values of each pixel are multiplied by the xcex1 channel value in advance. In other words, the second term of Equation (1) is found in advance. The 4 channels, namely xcex1, xcex1R, xcex1G, and xcex1B are then linearly interpolated In this method, the 3 values (xcex1R, xcex1G, and xcex1B) of the pixel shown in FIG. 6 become RGB=0, RGB=33, and RGB=33, as shown in FIG. 10. When enlargement by 2 is carried out, the values become RGB=0 (xcex1=0), RGB=16 (xcex1=0.5), RGB=33 (xcex1=1) , RGB=33 (xcex1=1), and RGB=33 (xcex1=1) . When an image having such pixel values is pasted onto the same black mount, no white streak is generated near the border where the xcex1 value changes from 1 to 0, since RGB=0 (xcex1=0), RGB=16 (xcex1=0.5), RGB=33 (xcex1=1), RGB=33 (xcex1=1), and RGB=33 (xcex1=1), as shown in FIG. 11.
As has been described above, interpolation of image data having the xcex1 channel can be carried out easily by adopting linear interpolation, although linear interpolation has a drawback such that it tends to create a blurry interpolated image. Therefore, in order to increase sharpness, high-degree interpolation operations such as the cubic spline interpolation and the B spline interpolation are carried out on the image data having the xcex1 channel.
In the case where a high-degree interpolation operation is carried out in order to improve sharpness as has been described above, image data after interpolation (interpolated image data) do not have monotonically increasing or decreasing data as in the case of linear interpolation. However, the interpolated image data have more or less over shoot or under shoot occurring at a border such as an edge included in the image. Such over shoot or under shoot brings preferable visual effects to an image. However, if a high-degree interpolation operation is carried out on image data having the xcex1 channel, an image of the mount can be seen at some portions where the xcex1 channel value changes, or cannot be seen at other portions where the xcex1 channel value also changes. In this manner, an artifact is created. In this case, it is possible to carry out a linear interpolation operation only on the xcex1 channel and to carry out a high-degree interpolation operation on the other channels. However, the xcex1 channel would not be harmonious with the other channels in this case and an artifact is also created.
The present invention has been created based on consideration of the above problems. An object of the present invention is to provide a method and an apparatus for obtaining an interpolated image having high sharpness and no artifact from image data having the xcex1 channel, and a computer-readable recording medium storing a program to cause a computer to execute the interpolation operation method.
An interpolation operation method of the present invention is an interpolation operation method of finding interpolated image data having pixel spacing different from that of original image data by interpolating the original image data comprising pixels each having a channel representing transparency and channels representing color or density, and the interpolation operation method comprises the steps of:
carrying out an interpolation operation different for each interpolation point, depending on the values of the channel representing transparency of all pixels in a predetermined area surrounding the interpolation point in the original image represented by the original image data.
The xe2x80x9cchannel representing transparencyxe2x80x9d means the xcex1 channel described above. The case of xcex1 being 1 means complete opaqueness while the case of xcex1 being 0 means complete transparency. The value of the xcex1 channel is represented in the same manner as the bit number of the channels representing the color or density, and 0xe2x88x921 is mapped as 0xe2x88x92255 in the case of 8-bit data.
The xe2x80x9cchannels representing the color or densityxe2x80x9d mean R, G, and B channels when each pixel is represented by RGB. Alternatively, the channels mean the hue channel, the saturation channel, and the lightness channel when each pixel is represented by hue, saturation, and lightness.
It is preferable for the interpolation operation method of the present invention to judge whether or not the value of the channel representing transparency indicates complete opaqueness for all pixels in the predetermined area surrounding the interpolation point so that
a high degree interpolation operation is carried out on the interpolation point, based on the pixel values in the predetermined area, when the judgment result is affirmative and
a linear interpolation operation is carried out on the interpolation point, based on the pixel values in the predetermined area, when the judgment result is negative.
In this case, it is preferable for the linear interpolation operation to be carried out after multiplied pixel values are found by multiplying the values of each pixel in the predetermined area and the value of the channel representing transparency at the pixel.
The phrase stating that xe2x80x9cjudgment result is affirmativexe2x80x9d means the case where the value of the channel representing transparency shows complete opaqueness for all pixels in the predetermined area, and means the case of the xcex1 channel value being 1 for all pixels if xcex1=1 indicates complete opaqueness. On the other hand, the phrase stating that xe2x80x9cjudgment result is negativexe2x80x9d means the case where the value of the channel representing transparency does not show complete opaqueness for at least one pixel in the predetermined area, and means the case of the xcex1 channel value being not 1 for at least one pixel if xcex1=1 shows complete opaqueness.
The xe2x80x9chigh degree interpolation operationxe2x80x9d means interpolation operations such as the cubic spline or B spline interpolation operations.
Furthermore, it is preferable for the interpolation operation method of the present invention to comprise the steps of:
calculating an index value representing opaqueness of the predetermined area surrounding the interpolation point, based on the values of the channel representing transparency of all pixels in the predetermined area;
carrying out a high degree interpolation operation on the interpolation point, based on the values of the pixels in the predetermined area, if the index value shows complete opaqueness; and
carrying out a linear interpolation operation on the interpolation point, based on the values of the pixels in the predetermined area, if the index value shows a state other then complete opaqueness.
As the xe2x80x9cindex value representing opaquenessxe2x80x9d, a product obtained by multiplying the values of the channel representing transparency in the predetermined area surrounding the interpolation point, or an average of the values of the channel representing transparency in the predetermined area can be used, for example. If xcex1=1 shows complete opaqueness and xcex1=0 means complete transparency for example, the product or the average, that is, the index value, shows complete opaqueness when it is 1, and shows transparency or semi-transparency otherwise.
Moreover, it is preferable for the interpolation operation method of the present invention to comprise the steps of:
calculating an index value indicating opaqueness of the predetermined area surrounding the interpolation point, based on the values of the channel representing transparency of all pixels in the predetermined area; and
setting an interpolation coefficient used for carrying out an interpolation operation on the interpolation point, based on the calculated index value; and
carrying out the interpolation operation based on the interpolation coefficient having been set.
xe2x80x9cSetting an interpolation coefficient based on the index valuexe2x80x9d means setting the interpolation coefficient to be suitable for high degree interpolation if the index value shows 1 meaning complete opaqueness while setting the interpolation coefficient to be suitable for linear interpolation if the index value shows a value other than 1 meaning transparency or semi-transparency as has been described above, for example.
An interpolation operation apparatus of the present invention is an interpolation operation apparatus for finding interpolated image data having pixel spacing different from that of original image data by interpolating the original image data comprising pixels each having a channel representing transparency and channels representing color or density, and the apparatus comprises interpolation operation means for carrying out an interpolation operation different for each interpolation point, based on the values of the channel representing transparency of all pixels in a predetermined area surrounding the interpolation point in an original image represented by the original image data.
It is preferable for the interpolation operation means in the interpolation operation apparatus of the present invention to comprise:
judging means for judging whether or not the value of the channel representing transparency shows complete opaqueness for all pixels in the predetermined area surrounding the interpolation point;
high degree interpolation means for carrying out a high degree interpolation operation on the interpolation point, based on the values of the pixels in the predetermined area, if the judgment result obtained by the judging means is affirmative; and
linear interpolation operation means for carrying out a linear interpolation operation on the interpolation point, based on the values of the pixels in the predetermined area, if the judgment result obtained by the judging means is negative.
In this case, it is preferable for the linear interpolation operation means to carry out the interpolation operation after multiplied pixel values are obtained by multiplying the values of each pixel in the predetermined area and the value of the channel representing transparency at the pixel.
In the interpolation operation apparatus of the present invention, it is preferable for the interpolation operation means to comprise:
index value calculating means for calculating an index value indicating opaqueness of the predetermined area surrounding the interpolation point, based on the values of the channel representing transparency of all pixels in the predetermined area;
high degree interpolation operation means for carrying out a high degree interpolation operation on the interpolation point, based on the values of the pixels in the predetermined area, if the index value indicates complete opaqueness; and
linear operation interpolation means for carrying out a linear interpolation operation on the interpolation point, based on the values of the pixels in the predetermined area, if the index value shows a state other than complete opaqueness.
Furthermore, it is also preferable for the interpolation operation means of the interpolation operation apparatus of the present invention to comprise:
index value calculating means for calculating an index value indicating opaqueness of the predetermined area for all pixels in the predetermined area surrounding the interpolation point, based on the value of the channel representing transparency; and
interpolation coefficient setting means for setting an interpolation coefficient for an interpolation operation to be carried out on the interpolation point, based on the index value calculated by the index value calculating means, and to carry out the interpolation operation based on the interpolation coefficient having been set.
The interpolation operation method of the present invention may be provided as a program stored in a computer-readable recording medium to cause a computer to execute the interpolation operation method.
According to the present invention, an interpolation operation which is different for each interpolation point is carried out on the interpolation point, based on the value of the channel representing transparency of all pixels in the predetermined area surrounding the interpolation point. Therefore, depending on transparency of the predetermined area surrounding the interpolation point, an appropriate interpolation operation such as a high degree interpolation operation enabling sharpness to be improved or a linear interpolation operation carried out easily although having low sharpness can be carried out on the interpolation point.
By carrying out a high degree interpolation operation on the interpolation point if the value of the channel representing transparency shows complete opaqueness for all pixels in the predetermined area surrounding the interpolation point and otherwise by carrying out a linear interpolation operation on the interpolation point, an interpolated image having high sharpness for a completely opaque area in an original image can be obtained, since a high degree interpolation operation can improve sharpness of the interpolated image compared to a linear interpolation operation. Meanwhile, for an area which is not completely opaque, that is, for an area which is transparent or semi-transparent, a linear interpolation operation is carried out and no artifact due to over shoot or under shoot which would be created by a high degree interpolation operation occurs. Therefore, an interpolated image having no artifact and high sharpness even at a border having changing transparency can be obtained. In this case, the image becomes blurry at the portion having changing transparency. However, a blurry original image does not cause any visual problems, since the portion having the changing transparency is blended into the mount.
In the case where a linear interpolation operation is carried out based on the multiplied pixel values obtained by multiplying the values of the pixels in the predetermined area and the value of the channel representing transparency, the values of the original image data in the portion having changing transparency do not change unnaturally, and an interpolated image having more naturally changing transparency can be obtained.
Furthermore, by calculating the index value representing opaqueness of the predetermined area based on the value of the channel representing transparency of all pixels in the predetermined area surrounding the interpolation point and by carrying out a high degree interpolation operation or a linear interpolation operation on the interpolation point if the index value indicates complete opaqueness or a state other than complete opaqueness respectively, an interpolated image having high sharpness for a completely opaque area in the original image and having no artifacts due to over shoot or under shoot which would be caused by a high degree interpolation operation in a transparent or semi-transparent area can be obtained. Therefore, an interpolated image having no artifacts and high sharpness even in an area having changing transparency can be obtained.
Moreover, by calculating the index value indicating opaqueness of the predetermined area, based on the value of the channel representing transparency of all pixels in the predetermined area surrounding the interpolation point, and by setting the interpolation coefficient for an interpolation operation based on the index value, the high degree interpolation coefficient for high sharpness or the linear interpolation operation coefficient for not creating artifacts and for easy operation execution can be set depending on opaqueness of the predetermined area surrounding the interpolation point. In this manner, an appropriate interpolation operation can be carried out in accordance with the opaqueness of the area surrounding the interpolation point.